package com.hong.utils;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

/**
 * @Auther: Administrator
 * @Date: 2018/7/21 19:14
 * @Description:
 */
public class CountDownLatchExample3 {
    public static void main(String[] args) throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(0);
        latch.await();
        System.out.println("===============================");
        new Thread(){
            @Override
            public void run() {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                latch.countDown();
            }
        }.start();
        latch.await(1000,TimeUnit.MICROSECONDS);
        System.out.println("====================");
        latch.countDown();

    }
}
